package cn.kgc.appinfo.service.impl;

import cn.kgc.appinfo.common.condition.AppInfoCondition;
import cn.kgc.appinfo.common.utils.Pager;
import cn.kgc.appinfo.entity.AppInfo;
import cn.kgc.appinfo.mapper.AppInfoMapper;
import cn.kgc.appinfo.service.AppInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AppInfoServiceImpl implements AppInfoService {

    @Autowired
    private AppInfoMapper appInfoMapper;

    @Override
    public List<AppInfo> selectAppInfoAllByAppInfoCondition(AppInfoCondition condition, Pager pager) {

        int count = appInfoMapper.selectAppInfoCountByCondition(condition);

        pager.setTotalRow(count);
        System.out.println("service"+pager);

        return appInfoMapper.selectAppInfoAllByAppInfoCondition(condition,pager);
    }

    @Override
    public AppInfo selectAppInfoById(Integer id) {
        return appInfoMapper.selectAppInfoById(id);
    }

    @Override
    public int selectAppInfoCountByAPKName(String apkName) {
        return appInfoMapper.selectAppInfoCountByAPKName(apkName);
    }

    @Override
    public int addAppInfo(AppInfo appInfo) {

        return appInfoMapper.addAppInfo(appInfo);
    }

    @Override
    public int updataAppInfo(AppInfo appInfo) {
        System.out.println("执行修改方法");
        return appInfoMapper.updataAppInfo(appInfo);
    }

    @Override
    public int deleteAppInfo(AppInfo appInfo) {
        return 0;
    }
}
